require('../app_api/models/db');
var hisDao = require('../app_api/dao/hospital.dao.js');
var testData = [
  {
    "hcode": "JL001",
    "name": "吉大一院",
    "address": "平治街2233",
    "gpsinfo": "88.32,41.22",
    "introduction": "三级级医院"
  },
  {
    "hcode": "JL002",
    "name": "吉大二院",
    "address": "平治街5566",
    "gpsinfo": "88.88,42.66",
    "introduction": "三级级医院AA"
  },
];

for(let data of testData){
  hisDao.createHospital(data, function(err, hospital) {
    //console.log('callback over.');
    if(err) {
      console.log(err);
      return;
    }
    //console.log(JSON.stringify(hospital, null, 2));
    //process.exit(0);
  });
}

hisDao.getHospitalList(null,20,function(err,rows){
  console.log('rows.length=',rows.length);
  if (err) {
    console.log(err);
    //res.status(400).json(err);
  }
  //res.status(200).json(rows);
  console.log(JSON.stringify(rows,null,2));
  process.exit(0);
});
